package com.sky.controller.User;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("UsershopController")
@RequestMapping("user/shop")
@Slf4j
@Api(tags = "管理端营业状态查询")
public class ShopController {
    private static final String key="SHOP_STATUS";
    @Resource
     RedisTemplate redisTemplate;
    @GetMapping("/ststus")
    @ApiOperation("获取店铺营业状态")
    public Result select(){
        Integer zhuantai  = (Integer) redisTemplate.opsForValue().get(key);
        log.info("店铺状态是：{}",zhuantai==1? "营业中":"打样了");
        return Result.success(zhuantai);
    }
}
